package com.dengdai.applibrary.utils;

import android.os.CountDownTimer;

/**
 * @说明 定时器
 * @作者 LY
 * @文件 MyCountDownTimer.java
 * @时间 2015年8月24日 上午9:15:41
 * @版权 Copyright(c) 2015 LY-版权所有
 */
public class MyCountDownTimer extends CountDownTimer {

    public MyCountDownTimer(long millisInFuture, long countDownInterval) {
        super(millisInFuture, countDownInterval);
    }

    @Override
    public void onFinish() {
        countDownTimerListener.onFinish();
    }

    @Override
    public void onTick(long millisUntilFinished) {
        countDownTimerListener.start(millisUntilFinished/1000);
    }

    public interface MyCountDownTimerListener {
        void start(long time);

        void onFinish();
    }

    public MyCountDownTimerListener countDownTimerListener;

    public void setCountDownTimerListener(MyCountDownTimerListener countDownTimerListener) {
        this.countDownTimerListener = countDownTimerListener;
    }

}

